package com.zzl.scala

import org.apache.spark.{SparkConf, SparkContext}

object BroadcastTest {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf()
      .setMaster("local")
      .setAppName("broadcast")
    val sc = new SparkContext(conf)
    val list = List("hello java")
    val broadcast = sc.broadcast(list)
    val linesRDD = sc.textFile("./word")
    linesRDD.filter(line=>{
      broadcast.value.contains(line)
    }).foreach(println)
    sc.stop()
  }
}
